<?php

require_once('lib/link.php');
$is_admin = $_SESSION['status_code'] == 'ADMIN';
?>
<script src="pages_admin/club/_club.js" type="text/javascript"></script>
<h3>Liens des partenaires</h3>
<?php echo $is_admin ? '<p class="add"><a href="?p=club&amp;r=links_edit">Ajouter un nouveau lien vers un partenaire</a></p>' : ''; ?>
<table class="dataTable">
	<thead>
	<tr>
		<th>Nom</th>
		<th>Lien</th>
		<?php echo $is_admin ? '<th>Action</th>' : ''; ?>
	</tr>
	</thead>
	<tbody>
<?php

$links = link_get_list();

while ($row = mysql_fetch_assoc($links)) {
	echo '
	<tr>
		<td>'.$row['name'].'</td>
		<td><a href="'.$row['url'].'">'.$row['url'].'</a></td>';
		if($is_admin)
		echo '
		<td>
			<a href="?p=club&amp;r=links_edit&amp;id='.$row['id'].'">
				<img src="images/icons/pencil.png" />
			</a>
			<span>
				<a href="javascript:void(0);" class="js-ask-validation" title="Supprimer ce lien">
					<img src="images/icons/delete.png" alt="supprimer" />
				</a>
				<div class="hidden decalhaut">
					Supprimer définitivement ?<br />
					<a href="javascript:void(0);" class="js-del-link b-oui" id="dellink_'.$row['id'].'"></a>
					<a href="javascript:void(0);" class="js-hide b-non"></a>
				</div>
			</span>
		</td>';

		echo '
	</tr>';
}
?>
	</tbody>
</table>
